package frame.laxcen.response;

import frame.laxcen.BaseFrame;
import frame.laxcen.exception.IllegalFrameFormatException;
import frame.laxcen.util.FrameReader;

import java.util.HashMap;
import java.util.Map;

// 返回读写器当前使用的天线
public class Response_0010_08 extends BaseFrame implements IResponse {

    public Response_0010_08(BaseFrame baseFrame) throws IllegalFrameFormatException {

        initialize(baseFrame.FrameBytes);
    }

    public Response_0010_08(byte[] bytes) throws IllegalFrameFormatException {

        initialize(bytes);
    }

    @Override
    public Map<String, String> explainToMap() throws IllegalFrameFormatException {

        Map<String, String> result = new HashMap<>();

        try {

            FrameReader reader = new FrameReader(this);

            // 天线使能配置

            result.put("天线使能配置", Integer.toBinaryString(reader.readU8()));

        } catch (Exception e) {

            e.printStackTrace();

            throw new IllegalFrameFormatException(e.getMessage());
        }

        return result;
    }
}
